1. Field of the Invention
The present invention relates to a method and apparatus for encoding a digital signal, a method and apparatus for transmitting a digital signal, and a recording medium on which a stream encoded by means of the above method and/or apparatus for encoding a digital signal is recorded. More particularly, the present invention relates to a method and apparatus for encoding a digital signal into a form suitable for use in a system for recording a bit stream generated by combining a plurality of bit streams into packets, and to a method and apparatus for use in a system for transmitting a signal in such the form via a transmission line. The present invention also relates to a recording medium for recording a signal in such the form.
2. Description of the Related Art
In recent years, the MPEG (Moving Picture Experts Group) standard has become very popular. After converting an analog signal into a digital form, the resultant signal is encoded according to the MPEG standard, and recorded on a recording medium such as an magneto optic disk or a magnetic tape. The information recorded on the recording medium is reproduced and displayed on a display device in a video telephone system, broadcasting system, and the like. In these applications, the signals are encoded according to the MPEG standard and then transmitted via a proper transmission line, and a receiving device decodes the received signal for its usage. The MPEG standard refers to the standard which has been discussed in ISO-IEC/JTC1/SC2/WG11 and proposed as the standard defining the encoding/decoding method. This standard is a hybrid of an encoding method based on the expectation of motion and an encoding based on the discrete cosine transform. The technique is disclosed for example in the description and the drawings in U.S. Pat. No. 5,155,593 invented by the inventor of the present invention (date of patent: Oct. 13, 1992).
In the multimedia technology, different types of data such as a video signal, an audio signal, and related data are combined together and transmitted in a multiplexed fashion. At a receiving end, the received data is separated into individual data such as the video signal and the audio signal, and then these separated data are reproduced while maintaining the synchronization with each other.
When a plurality of data are combined together or multiplexed, a predetermined number of video and audio signals are first encoded separately thereby generating encoded streams for the respective signals, and then these streams are combined together.
After combining the plurality of data together, the resultant stream (multiplexed stream) is converted into the form of packet for each access unit such as a video elementary stream and an audio elementary stream, as shown in FIG. 1. Each packet contains information (clock reference) indicating when the packet should be input to a decoder and also contains information indicating when the access unit should be decoded (displayed). The "access unit" refers to an unit of decoded information. For example, in the case of a video signal, an access unit corresponds to a frame of data. In the case of an audio signal, an access unit corresponds to an audio frame.
If the time of decoding is incorporated into the respective encoded video and audio signals in the above-described manner, it becomes possible to achieve synchronization between the video and audio signals in the final output.
Streams used in MPEG systems will be described below. The streams used in the MPEG systems can be grouped into two types: transport streams and program streams. The transport stream is used for transmission in an environment where an error such as a bit error or cell loss can occur. More particularly, this type of stream is used in transmission for example over an ATM network or a communication line for digital broadcasting. On the other hand, the program stream is used to record information in an environment where an error is unlikely to occur. In particular, this type of stream is used to record information on a recording medium such as a magnetic disk or a magnetic tape.
Each stream will now be described in detail below with reference to FIG. 1.
A transport stream is composed of, as shown in FIG. 1A, various areas including adaptation fields, video elementary streams, and audio elementary streams, wherein each area has its own transport stream header. The video elementary streams and the audio elementary streams each have their own packet header. The clock reference described above is encoded in adaptation fields, and the time of decoding is encoded in packet headers.
As shown in FIG. 1B, a program stream is composed of areas including video elementary streams and audio elementary stream each having their own packet header. The program stream also includes pack headers. In this case, the clock reference is encoded in pack headers, and time of decoding is encoded in the packet headers.
When these elements are combined together into a transport stream or a program stream, it is assumed that the encoding be performed so that the resultant stream can be correctly decoded by a standard decoder (system target decoder (STD).
Referring now to FIG. 2, a typical digital signal encoder will be described below. When an elementary stream is input to the encoder shown in FIG. 2, the elementary stream is supplied to an access unit detector 41 and a packetizer 43. The access unit detector 41 extracts an access unit from the elementary stream and detects the size of the access unit and also detects the information representing the time of decoding. The access unit detector 42 supplies the detected information about the size of the access unit to a scheduler 42, and supplies the detected information about the time of decoding to both the scheduler 42 and the packetizer 43.
The scheduler 42 calculates the clock reference and the size of a packet on the basis of the information about the size of the access unit and the time of decoding. The resultant values are applied to the packetizer 43. The packetizer 43 converts the received elementary stream into the form of packets. The packetizer 43 also encodes the decoding time information supplied from the access unit detector 41 and the clock reference supplied from the scheduler. These data are combined into a MPEG system stream (a transport stream or a program stream) such as that shown in FIG. 1.
In the case where the output system stream from this packetizer 43 is a transport stream, the system stream is transmitted to a decoder such as that shown in FIG. 3 via a predetermined transmission channel 44. On the other hand, if the output system stream from this packetizer 43 is a program stream, it is recorded on a predetermined recording medium 45. The stream recorded on the recording medium can be reproduced from the recording medium and applied to a decoder such as that shown in FIG. 4.
The system target decoder (STD) will now be described below.
According to the MPEG-2 standard, the standard decoder for decoding a transport stream has a structure such as that shown in FIG. 3.
In the standard decoder for decoding a transport stream, shown in FIG. 3, an input stream is stored in a buffer once and then decoded at the specified time.
That is, in the standard decoder having buffers, clock reference is first detected from each access unit to be decoded, and data is input to the STD at the specified time.
The input data is separated by a switch 81 into different types of streams such as a video elementary stream, audio elementary stream, and the like, which are in turn supplied to a first-stage buffer 82.
The first-stage buffer 82 includes a video transport buffer and a plurality (N channels) of audio transport buffers. The access unit associated with the video elementary stream is supplied to the video transport buffer. The access unit associated with the audio elementary stream is supplied to a corresponding audio transport buffer.
The first-stage buffer 82 transfers the received data to a second-stage buffer (main buffer) 83 at a predetermined rate.
The second-stage buffer 83 includes a video main buffer and audio main buffers corresponding to the video transport buffer and the audio transport buffers in the first-stage buffer 82. The data transferred to the second-stage buffer 83 is stored in a corresponding main buffer of these. The second-stage buffer 83 detects the decoding time (time stamp) associated with the stored data, and transfers the data to a decoder 84 at the detected decoding time. The decoder 84 decodes the received data and outputs the resultant data.
Since the data which has been separated into individual access units is stored in the STD buffer until the specified time, it is required that the data should be multiplexed and encoded so that neither overflowing nor underflowing occurs when it is decoded.
FIG. 4 illustrates a standard decoder for decoding a program stream generated according to the MPEG-2 standard or a system stream generated according to the MPEG-1 standard. In the case of video elementary streams according to the MPEG-2 or MPEG-1 standard or in the case of audio elementary streams according to the MPEG-2 or MPEG-1 standard, the data is decoded by a standard decoder including an one-stage buffer 101 as opposed to the transport streams. In the case where a private stream defined by a specific user is decoded using a decoder including two stages of buffers 103 and 104, it is required that the data should be encoded so that the resultant encoded data can be decoded by the decoder with the two-stage buffer as in the transport streams.
To prevent the overflowing and underflowing in either the first-stage buffer or the second-stage buffer when a transport stream or a program stream is decoded, it is required that during the encoding operation the clock reference should be generated while monitoring the size of data occupying the two buffers. This results in extreme complexity in the algorithm of combining data together.
Furthermore, in either the one-stage buffer decoder or the two-stage buffer decoder, since the decoding time is defined for each access unit the number of operations of converting the data into packets increases with the reducing size of the access unit.
It is a general object of the present invention to solve the above problems. More specifically, it is an object of the present invention to provide a digital signal encoding method and apparatus, and a digital signal transmission method and apparatus, capable of dealing with signals with an extremely simplified algorithm. It is another object of the present invention to provide a recording medium for recording data in the form of a stream encoded using such the method and/or apparatus.
It is still another object of the present invention to provide a digital signal encoding method and apparatus, and a digital signal transmission method and apparatus, capable of easily encoding data without having to monitor the size of data occupying buffers over the whole stages. It is another object of the present invention to provide a recording medium for recording data in the form of a stream encoded using such the method and/or apparatus.
It is another object of the present invention to provide a digital signal encoding method and apparatus, and a digital signal transmission method and apparatus, capable of encoding data in a highly efficient fashion with a reduced number of operations of converting the data into packets. It is another object of the present invention to provide a recording medium for recording data in the form of a stream encoded using such the method and/or apparatus.